package com.pingan.generator.api.entity.util;

/**
 * 
 * @author ouyangenkun051
 *
 */
public class Response<T> {
    private String code;
    private String message;
    private T data;

    public Response(){}
    public Response(String code, String message) {
        this.code = code;
        this.message = message;
    }
    public Response(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    
	public static Response<Object> success() {
        return new Response<Object>(Result.Code.success,Result.Msg.success);
    }
	public static<T> Response<T> success(T data) {
        return new Response<T>(Result.Code.success,Result.Msg.success,data);
    }

    public static<T> Response<T> failure(String code, String msg) {
        return new Response<T>(code,msg);
    }
    public static<T> Response<T> failure() {
        return new Response<T>(Result.Code.failure,Result.Msg.failure);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    

    public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public Object getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
